package entity;

public class ESQ1616Register extends ENumberRegister {
	private Double value = -1.;
	
	public ESQ1616Register(String name, int address, String dataType,
			String description, String unit, double min, double max) {
		super(name, address, dataType, description, true, unit, min, max);
	}

	@Override
	public Object getValue() {
		return value;
	}

	@Override
	public void setValue(byte b0, byte b1, byte b2, byte b3) {
		Double newValue = (short) ((b2 & 0xff)) + (short)((b3 & 0xff) << 8) 
				+ (((int) b0 & 0xff) + (((int) b1 & 0xff) << 8))/Math.pow(2,16);
		
		this.value = newValue;
		setChanged();
		notifyObservers(value);
	}
        
        @Override
        public String toString(){
            return String.valueOf(value);     
        }
        
}
